(function($) {

   $.cleditor.buttons.video = {
    name: "video",
    image: '',
	css: {
		background: 'url(/images/file-types/video.png)',
		backgroundPosition: 'center center',
		backgroundRepeat: 'no-repeat'
	},
	title: "Insert video",
    command: "inserthtml",
    popupName: "video",
    popupClass: "cleditorPrompt",
    popupContent: "Укажите адресс видео файла:<br><input type=text value='http://' size=35><br><input type=button value='Submit'>",
    buttonClick: videoClick
  };
      
 
  $.cleditor.defaultOptions.controls = $.cleditor.defaultOptions.controls
    .replace("audio", "audio video");
      
 
  function videoClick(e, data) {
      
    $(data.popup).children(":button")
      .unbind("click")
      .bind("click", function(e) {
      
 
        // Get the editor
        var editor = data.editor;
      
 
        // Get the entered name
        var name = $(data.popup).find(":text").val();
        // Insert some html into the document
        var html = '';
		html += '$video=' + name + '$';
        editor.execCommand(data.command, html, null, data.button);
      
 
        // Hide the popup and set focus back to the editor
        editor.hidePopups();
        editor.focus();
      
 
      });
  }  
})(jQuery);